package dptest;


public class t322 {
	public static void main(String[] args) {
		int coins [] = {1,2,5};
		int num = 11;
		int dp [] = new int[num+1];
		dp[0] = 0;
		for(int i = 1 ; i<=num; i++) {
			dp[i] = Integer.MAX_VALUE;
			for(int j = 0;j<coins.length;j++) {
				if(i-coins[j]>=0 && dp[i-coins[j]]!=Integer.MAX_VALUE) {
					dp[i] = Math.min(dp[i-coins[j]]+1, dp[i]);
				}
				
			}
		}
		/*if(dp[num] == Integer.MAX_VALUE) {
			return -1;
		}else {
			return dp[num];
		}*/
		
		System.out.println(dp[num]);
		
	}
}
